package com.hzy.utils;

import com.hzy.pojo.Booking;
import com.hzy.pojo.Booking;
import lombok.Data;

import java.util.List;

/**
 * @Package: com.hzy.utils
 * @ClassName: Page
 * @Author: 862982795
 * @CreateTime: 2021/06/22 17:27
 * @Description:
 */
@Data
public class Page {
    // 总页数
    private Integer totalPageCount = 0;
    // 记录总数，总共多少条记录
    private Integer totalCount;
    // 当前页码
    private Integer currPageNo = 1;
    // 每页集合
    private List<Booking> bookingList;

    //查询条件
    private String userName;    // 用户名
    private String cardId;      // 身份证号
    //查询索引
    private Integer pageBegin = 0;
    // 页面大小，即每页显示记录数
    private Integer pageSize = 3;


    public Integer getPageBegin() {
        return pageBegin;
    }

    public void setPageBegin(Integer pageBegin) {
        this.pageBegin = pageBegin;
    }

    public List<Booking> getBookingList() {
        return bookingList;
    }

    public void setBookingList(List<Booking> BookingList) {
        this.bookingList = BookingList;
    }

    public Integer getTotalPageCount() {
        return totalPageCount;
    }

    public void setTotalPageCount(Integer totalPageCount) {
        this.totalPageCount = totalPageCount;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(String pageSizeStr) {       // 判断需要查询的页面是否合理
        if (pageSizeStr != null && !pageSizeStr.equals(""))
            this.pageSize = Integer.valueOf(pageSizeStr);
    }

    public Integer getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Integer totalCount) {
        if (totalCount > 0) {
            this.totalCount = totalCount;
            // 计算总页数
            totalPageCount = this.totalCount % pageSize == 0 ? (this.totalCount / pageSize)
                    : (this.totalCount / pageSize + 1);
        }
    }

    public Integer getCurrPageNo() {
        return currPageNo;
    }

    public void setCurrPageNo(String currPageNoStr) {
        if (currPageNoStr != null && !currPageNoStr.equals("")) {
            this.currPageNo = Integer.valueOf(currPageNoStr);
            this.pageBegin = (this.currPageNo - 1) * pageSize;
        }
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getCardId() {
        return cardId;
    }

    public void setCardId(String cardId) {
        this.cardId = cardId;
    }
}
